package com.yh.csx.event.store.gateway.subscribe.dataobject;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * @author zhangsheng
 * @date 2021/8/11 14:56
 */
@Entity
@Table(name = "subscribe_config" )
public class SubscribeConfigDo {
    private Long id;
    private String name;
    private Long producerId;
    private Long consumerId;
    private String desc;
    private String creator;
    private String updater;
    private Date createTime;
    private Date updateTime;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 100)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "producer_id", nullable = false)
    public Long getProducerId() {
        return producerId;
    }

    public void setProducerId(Long producerId) {
        this.producerId = producerId;
    }

    @Basic
    @Column(name = "consumer_id", nullable = false)
    public Long getConsumerId() {
        return consumerId;
    }

    public void setConsumerId(Long consumerId) {
        this.consumerId = consumerId;
    }

    @Basic
    @Column(name = "desc", nullable = false, length = 200)
    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Basic
    @Column(name = "creator", nullable = false, length = 100)
    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    @Basic
    @Column(name = "updater", nullable = false, length = 100)
    public String getUpdater() {
        return updater;
    }

    public void setUpdater(String updater) {
        this.updater = updater;
    }

    @Basic
    @Column(name = "create_time", nullable = false)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "update_time", nullable = false)
    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SubscribeConfigDo that = (SubscribeConfigDo) o;
        return id == that.id &&
                producerId == that.producerId &&
                consumerId == that.consumerId &&
                Objects.equals(name, that.name) &&
                Objects.equals(desc, that.desc) &&
                Objects.equals(creator, that.creator) &&
                Objects.equals(updater, that.updater) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, producerId, consumerId, desc, creator, updater, createTime, updateTime);
    }
}
